// pages/myself/myself.js
var app = getApp();
var API_URL = app.globalData.API_URL;
Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      if (options.id == undefined || options.id == '')
      {
        var id = 0;
      }else{
        var id = options.id;
      }
      var that = this;
      var uuid = wx.getStorageSync('uuid');
      wx.request({
        url: API_URL + 'my/info',
        method: "POST",
        data: {uuid: uuid },
        header: {
          'content-type': 'application/x-www-form-urlencoded', // 默认值
          // 'PROJECTID' :2,
          // 'SOURCE' : 215,
          'token': wx.getStorageSync('token'),
          'UUID': wx.getStorageSync('uuid')
        },
        success: function (res) {
          var uInfo = res.data.data;
          // console.log(uInfo)
          that.setData({
            uInfo: uInfo,
            phone: uInfo.phone,
            realname: uInfo.realname,
            province: uInfo.province,
            city: uInfo.city,
            area:uInfo.area,
            street: uInfo.street,
            region: [uInfo.province ? uInfo.province : '全部', uInfo.city ? uInfo.city : '全部', uInfo.area ? uInfo.area : '全部'],
            id: id
          })
        }
      });
  },
  // 跳转到创建名片
  manageTap:function(event){
      wx.navigateTo({
        url: '/pages/createcard/createcard',
      })
  },
  // 隐私设置
  privacyTap:function(event){
    wx.navigateTo({
      url: '/pages/privacy/privacy',
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})